import request from '@utils/request'

// 查询学生信息
export function getStudent (data) {
  return request({
    url: '/merchantUser/getPageList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
// 查询不同校区学生人数
export function getCampusStudent (data) {
  return request({
    url: '/merchantUser/getUserCount',
    method: 'get',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
// 查询不同学生类型人数
export function getStudentType (data) {
  return request({
    url: '/merchantUser/getUserByTypeCount',
    method: 'get',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
// 增加学生
export function addStudent (data) {
  return request({
    url: '/merchantUser/saveUser',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
// 修改学生信息
export function updateStudent (data) {
  return request({
    url: '/merchantUser/update',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除学生信息
export function deleteStudent (data) {
  return request({
    url: '/merchantUser/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 解绑手机
export function removePhone (data) {
  return request({
    url: '/merchantUser/userUntie',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导入学生信息
export function uploadStudent (data) {
  return request({
    url: '/merchantUser/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导入学生辅导员
export function uploadStudentAdmin (data) {
  return request({
    url: '/merchantUser/uplodeUser',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 导出学生信息
export function exportStudent (data) {
  return request({
    url: '/merchantUser/export',
    method: 'post',
    data: data,
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 下载学生信息模板
export function downLoadExcelStudent (data) {
  return request({
    url: '/merchantUser/downLoadExcel',
    method: 'post',
    data: data,
    responseType: 'blob',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 获取班级下拉
export function getClassName (data) {
  return request({
    url: '/gradeInformation/getClassName',
    method: 'get',
    params: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}